package com.pingan.haofang.searchcloud.index.constants;

import java.util.HashMap;
import java.util.Map;

/**
 * 索引构建状态
 *
 * @author LUYI374
 * @date May 16, 2017
 * @since 1.0.0
 */
public enum IndexBuildStatus {

    TODO(0, "待执行"), RUNNING(1, "执行中"), SUCCESS(2, "成功"), FAIL(3, "失败"), STOP(4, "终止"), PAUSE(5, "暂停");

    public final int value;
    public final String desc;
    private static Map<Integer, IndexBuildStatus> MAP = new HashMap<>();

    IndexBuildStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    static {
        for (IndexBuildStatus tmp : IndexBuildStatus.values()) {
            MAP.put(tmp.getValue(), tmp);
        }
    }

    public int getValue() {
        return value;
    }

    public static IndexBuildStatus get(int id) {
        return MAP.get(id);
    }
}
